package org.simplecrm.controllers.customers.propertyeditors;

import org.simplecrm.domain.region.Region;

import java.beans.PropertyEditorSupport;

/**
 * Created by oler on 16.09.14.
 */
public class RegionPropertyEditor extends PropertyEditorSupport {

    @Override
    public void setAsText(String text) throws IllegalArgumentException {

        if (text.trim().equals("")) {
            return;
        }

        Region region = new Region();
        region.setId(Integer.parseInt(text));

        setValue(region);
    }

}
